using System.Collections.Generic;

namespace JSC.Portal.Entities
{
	public partial class ModuleType : DescriptiveEntity
	{
        public override bool CanDelete
        {
            get
            {
                return base.CanDelete && Sections.Count == 0;
            }
        }

        public void AddSection(Section section)
        {
            if (Sections != null && !Sections.Contains(section))
            {
                Sections.Add(section);
            }
        }

        public void RemoveSection(Section section)
        {
            if (Sections != null && Sections.Contains(section))
            {
                Sections.Remove(section);
            }
        }

		public void AddModuleProperty(ModuleProperty moduleProperty)
        {
            if (ModuleProperties != null && !ModuleProperties.Contains(moduleProperty))
            {
                ModuleProperties.Add(moduleProperty);
            }
        }

        public void RemoveModuleProperty(ModuleProperty moduleProperty)
        {
            if (ModuleProperties != null && ModuleProperties.Contains(moduleProperty))
            {
                ModuleProperties.Remove(moduleProperty);
            }
        }
	}
}
